package com.clear.wechat.handler.enums;

/**
 * 微信消息枚举
 */
public enum WechatMSGEnum {
    SUBSCRIBE("event.subscribe", "用户关注事件"),
    TEXT_MSG("text", "接收用户文本消息");

    private String msgType;
    private String desc;

    WechatMSGEnum(String msgType, String desc) {
        this.msgType = msgType;
        this.desc = desc;
    }

    /**
     * 根据枚举类型获取枚举
     *
     * @return
     */
    public static WechatMSGEnum getByMsgType(String msgType) {
        for (WechatMSGEnum wechatMSGEnum : WechatMSGEnum.values()) {
            if (wechatMSGEnum.msgType.equals(msgType)) {
                return wechatMSGEnum;
            }
        }
        return null;
    }
}
